<template>
	<div class="chart">
		<el-table :data="tableData" style="width: 100%">
			<el-table-column prop="iserIcon" label="头像">
				<template  #default="scope">
					<img style="width:50px;height:50px;object-fit: cover;" :src="baseUrl+scope.row.outletLogo"/>
				</template>
			</el-table-column>
			<el-table-column prop="outletName" label="门店名"  />
			<el-table-column prop="adminAccount" label="账号" />
			<el-table-column label="操作">
				<template #default = "score">
					<!-- <el-button type="primary" style="width: 50px; cursor: pointer;" @click="goupdatestore(score.row)">修改</el-button> -->
					<el-button type="info"	style=" width: 50px; cursor: pointer;" @click="delstore(score.row.outletId)" >更多</el-button>
				</template>
			</el-table-column>
		</el-table>
		<el-pagination
		layout="prev,pager,next"
		:page-count="total"
		:page-size="pageSize"
		v-model:current-page="pageIndex"	
		@current-change="changePage"
		></el-pagination>
	</div>
</template>

<script setup>
	import { onMounted, reactive, ref } from 'vue'
	import {outletinfo} from "../api/zhy"
	import {baseUrl} from "../utils/request.ts"
	import {useRouter} from "vue-router"
	let adminids=reactive({})
	let pageIndex=ref(1)
	let pageSize=ref(5)
	let total=ref(0)
	let tableData=ref([])
	const router=useRouter()
	adminids=JSON.parse(sessionStorage.getItem('Msg')) 
	const initcenterinfo=async()=>{
		let res=await outletinfo({
			adminId: Number(adminids.adminId),
			page:Number(pageIndex.value),
			size:Number(pageSize.value)
		})
		console.log(res,"res")
		tableData.value=res.outlets
		total.value=res.totalPages

	}
	initcenterinfo()
	const delstore=(item)=>{
		console.log(item,"item")
		router.push("/branch?adminId="+adminids.adminId+"&outletId="+item)
	}
	const changePage=(page)=>{
		pageIndex.value=page
		initcenterinfo()
	}
</script>

<style scoped lang="less">
	:deep(.el-table tr){
		height:70px;
	}
	:deep(.el-table .el-table__cell){
		text-align: center !important;
	}
	img{
		border-radius: 50%;
	}
	// 分页样式
	.el-pagination{
		--el-pagination-bg-color:none;
		--el-pagination-button-disabled-bg-color:none;
		justify-content: center;
	}
</style>